package com.example.spring_demo.homework.注解;

import com.example.spring_demo.service.BookDao;
import com.example.spring_demo.service.BookService;
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;

public class AppForAnnotation {
    public static void main(String[] args) {
        ApplicationContext ctx=new AnnotationConfigApplicationContext(SpringConfig.class);
        BookDao bookDao1= ctx.getBean( BookDao.class);
        BookDao bookDao2= ctx.getBean(  BookDao.class);
        System.out.println(bookDao1);
        System.out.println(bookDao2);
        BookService bookService=(BookService) ctx.getBean("bookService");
        System.out.println(bookService);
        bookService.save();
    }
}
